﻿@{
    ViewBag.Title = Local("CategoriesView.PageTitle");
}

@model IEnumerable<Category>
           
@if (Model != null)
{ 
<div class="box">
    <div class="tright">
        <button onclick="return openModal('@CUrls.DialogCategoryView?app=@ViewBag.ApplicationType', 500);">@GLocal("Category.New")</button>
    </div>
    <table cellpadding="0" cellspacing="0">
        <thead class="ui-widget-header">
            <tr>
                <td>@GLocal("Category.CategoryName")</td>
                <td>@GLocal("Category.Key")</td>
                <td>@GLocal("Category.ApplicationType")</td>
                <td>@GLocal("Category.CreateDate")</td>
                <td>@GLocal("Category.Threads")</td>
                <td>@GLocal("Category.Action")</td>
            </tr>
        </thead>
        <tbody>
            @foreach (var category in Model)
            { 
            <tr>
                <td>├─@category.CategoryName</td>
                <td>@category.Key</td>
                <td>@GLocal(category.ApplicationType)</td>
                <td>@category.CreateDate.ToLocalDateTimeString()</td>
                <td>@category.Threads</td>
                <td>
                    <a href="javascript:void(0);" onclick="return openModal('@CUrls.DialogCategoryView?id=@category.CategoryID', 500);">@GLocal("Category.Edit")</a>
                    @Html.AjaxLink(HttpAction.Delete, "Category.Delete", new{did = category.CategoryID})
                </td>
            </tr>  
                if (category.Children != null)
                {
                    @CPHelper.ShowCategories(category, 1)
                }
            }
        </tbody>
    </table>
</div>
}
